home *** CD-ROM | disk | FTP | other *** search
- /*
- * FLMaca.h - MacWrite document structures, versions 2.2 and 4.5
- *
- * The comments below are mostly non-edifying. A copy of
- * Macintosh Technical Notes 11 and 12 is a necessity, as they
- * describe document formats in detail.
- *
- * One difference is that the "active face" in the window variables
- * is really a point size (high byte) and style (low byte), not just
- * a style.
- */
-
-
- # ifndef _FLMaca_
- # define _FLMaca_
-
-
-
- /*
- * Typedef Int16 and Int32 appropriately. Everything in the Maca
- * project is typed using these to facilitate conversion to other
- * C compilers
- */
-
- typedef short Int16; /* 16-bit integer */
- typedef long Int32; /* 32-bit integer */
-
-
- typedef enum /* supported versions of MacWrite */
- {
- version3 = 3, /* MacWrite 2.2 */
- version6 = 6 /* MacWrite 4.5 */
- };
-
-
- typedef enum /* document types */
- {
- mainDoc = 0,
- headDoc = 1,
- footDoc = 2
- };
-
-
- typedef enum /* paragraph types */
- {
- rulerPara = 0,
- textPara = 1,
- pictPara = 2
- };
-
-
- typedef enum /* justification types */
- {
- leftJust = 0,
- centerJust = 1,
- rightJust = 2,
- fillJust = 3
- };
-
-
- /*
- * Types common to all versions
- */
-
- typedef Byte ByteBool; /* byte-size boolean */
- typedef Byte UPrintRec[120]; /* 120-byte universal printing record */
- /* (anyone know what's in it?) */
-
-
- typedef struct Selection
- {
- Int16 selPara; /* selection paragraph number */
- Int16 selPos; /* selection char position (start or end) */
- } Selection;
-
-
- typedef struct ActiveFace
- {
- Byte faceSize; /* point size */
- Byte faceStyle; /* style */
- } ActiveFace;
-
-
- typedef struct Format
- {
- Int16 fmtPos; /* pos of first char format applies to */
- Byte fmtSize; /* point size */
- Byte fmtStyle; /* style */
- Int16 fmtFont; /* font number */
- } Format;
-
-
- typedef struct Ruler
- {
- Int16 margLeft; /* left margin */
- Int16 margRight; /* right margin */
- Byte just; /* justification */
- Byte nTabs; /* number of tabs */
- Int16 spacing; /* line spacing = 1 + (spacing/2) */
- Int16 indent; /* indentation of first line */
- Int16 tab[10]; /* tab values */
- Byte fill[4]; /* unused */
- } Ruler;
-
-
- /*
- * MacWrite 2.2 (version number 3) data structures
- */
-
-
- typedef struct Globals3 /* version 2.2 globals */
- {
- Int16 version; /* version number (always 3) */
- Int16 paraOffset; /* offset to paragraph information */
- Int16 mainParas; /* main doc paragraph count */
- Int16 headParas; /* header paragraph count */
- Int16 footParas; /* footer paragraph count */
- ByteBool titlePage; /* title page flag */
- Byte fill[2]; /* unused */
- ByteBool showFoot; /* true if footer displayed */
- ByteBool showHead; /* true if header displayed */
- ByteBool showRuler; /* true if rulers displayed */
- Int16 activeDoc; /* active document */
- Int16 startPage; /* starting page number */
- } Globals3;
-
-
- typedef struct ParaInfo3
- {
- Int16 paraHeight; /* height of paragraph (pixels) */
- Int16 paraPos; /* position from top of page */
- Byte paraPage; /* page number */
- Byte fill[3]; /* unused */
- } ParaInfo3;
-
-
- typedef struct Windows3 /* version 2.2 window variables */
- {
- Selection selStart; /* start of selection */
- Selection selEnd; /* end of selection */
- Int16 vertOffset; /* vertical offset */
- Int16 redrawPara; /* first paragraph to redraw */
- Point pageIconPt; /* page icon position */
- Point dateIconPt; /* date icon position */
- Point timeIconPt; /* date icon position */
- Byte fill[4]; /* unused */
- ByteBool iconRedraw; /* true if icons should be redrawn */
- ByteBool iconFlag; /* true if rulers shown when icons last drawn */
- Int16 activeFont; /* font active when saved */
- ActiveFace activeFace; /* face active when saved */
- } Windows3;
-
-
- typedef struct DocInfo3 /* version 2.2 document information */
- {
- Globals3 globals3; /* globals */
- UPrintRec uPrintRec; /* universal printing record */
- Windows3 mainWind3; /* main doc window information */
- Windows3 headWind3; /* header window information */
- Windows3 footWind3; /* footer window information */
- } DocInfo3;
-
-
- /*
- * MacWrite 4.5 (version number 6) data structures
- */
-
-
- typedef struct Globals6 /* version 4.5 globals */
- {
- Int16 version; /* version number (always 6) */
- Int16 mainParas; /* main doc paragraph count */
- Int16 headParas; /* header paragraph count */
- Int16 footParas; /* footer paragraph count */
- ByteBool titlePage; /* title page flag */
- Byte fill; /* unused */
- ByteBool showScrap; /* true if scrap displayed */
- ByteBool showFoot; /* true if footer displayed */
- ByteBool showHead; /* true if header displayed */
- ByteBool showRuler; /* true if rulers displayed */
- Int16 activeDoc; /* active document */
- Int16 startPage; /* starting page number */
- Int32 freePos; /* free list position */
- Int16 freeLen; /* free list length */
- Int16 freeAlloc; /* bytes allocated for free list on disk */
- Byte fill2[14]; /* unused */
- } Globals6;
-
-
- typedef enum /* status byte bitmasks */
- {
- stJustMask = 0x03, /* justification code */
- stInUse = 0x04, /* bit set if paragraph is in use */
- stCompress = 0x08, /* bit set if text is compressed */
- stOnItsWay = 0x10, /* bit set if disk i/o started, not done */
- stInMemory = 0x20, /* bit set if paragraph is in memory */
- stJustify = 0x40, /* bit set if just code above used */
- /* otherwise use ruler */
- stDirty = 0x80 /* set if paragraph is dirty */
- };
-
-
- typedef enum /* justification codes relating to stJustMask */
- {
- stJustLeft = 0x00,
- stJustCenter = 0x01,
- stJustRight = 0x02,
- stJustFull = 0x03
- };
-
-
- typedef union ParaStOff
- {
- Byte paraStatus; /* paragraph status */
- Int32 paraOffset; /* position of paragraph data */
- /* (low 3 bytes only) */
- } ParaStOff;
-
-
- typedef struct ParaInfo6
- {
- Int16 paraHeight; /* height of paragraph (pixels) */
- Int16 paraPos; /* position from top of page */
- Int32 paraHandle; /* handle to paragraph */
- ParaStOff paraStOff; /* data position/status */
- Int16 paraLen; /* length of paragraph data */
- Int16 paraFmts; /* common formats */
- } ParaInfo6;
-
- typedef ParaInfo6 InfoArray6[1]; /* used as variable-length */
-
-
- typedef struct Windows6 /* version 4.5 window variables */
- {
- Selection selStart; /* start of selection */
- Selection selEnd; /* end of selection */
- Int16 vertOffset; /* vertical offset */
- Int16 redrawPara; /* first paragraph to redraw */
- Int32 infoPos; /* position of information array */
- Int16 infoLen; /* length of information array */
- Int32 linePos; /* position of line height array */
- Int16 lineLen; /* length of line height array */
- Point pageIconPt; /* page icon position */
- Point dateIconPt; /* date icon position */
- Point timeIconPt; /* date icon position */
- Byte fill[4]; /* unused */
- ByteBool iconRedraw; /* true if ovals (icons) should be redrawn */
- ByteBool iconFlag; /* true if rulers shown when ovals last drawn */
- ActiveFace activeFace; /* face active when saved */
- Int16 activeFont; /* font active when saved */
- } Windows6;
-
-
- typedef struct DocInfo6 /* version 4.5 document information */
- {
- Globals6 globals6; /* globals */
- UPrintRec uPrintRec; /* universal printing record */
- Windows6 footWind6; /* footer window information */
- Windows6 headWind6; /* header window information */
- Windows6 mainWind6; /* main doc window information */
- } DocInfo6;
-
-
- /*
- * External definitions
- */
-
-
- /*
- * File variables
- */
-
-
- extern Int16 macaFRef; /* file descriptor */
- extern Str255 macaName; /* file name */
- extern Int16 macaRefNum; /* volume reference number */
- extern Int32 paraFilePos; /* position of last paragraph read */
-
- extern Int16 version;
- extern Int16 paraOffset;
- extern Int16 mainParas;
- extern Int16 headParas;
- extern Int16 footParas;
-
- extern Int32 infoPos;
- extern Int16 infoLen;
-
- extern Windows3 *headWind3, *footWind3, *mainWind3;
- extern Windows6 *headWind6, *footWind6, *mainWind6;
-
- extern DocInfo3 docInfo3;
- extern DocInfo6 docInfo6;
-
- extern Handle paraBuf; /* buffer for contents of paragraph */
- extern Int16 totalParas; /* total paragraphs in document */
- extern Int16 paraNum; /* current paragraph number */
- extern Int16 paraDocType; /* whether main, header or footer para */
- extern Int16 paraType; /* paragraph type (text, ruler, picture) */
- extern Int16 paraLen; /* paragraph length */
- extern Int16 textLen; /* length of text in text paragraphs */
- extern Int16 formats; /* number of formats in text paragraph */
- extern Int16 fmtOffset; /* offset w/in text paragraph to formats */
- extern InfoArray6 **paraInfo6; /* info array (for version 6 only) */
-
-
- /*
- * Functions returning non-int
- */
-
- Boolean OpenMaca ();
- Boolean ReadPara ();
-
- # endif
-